package com.ruoyi.system.domain.dto;

import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.constant.UserConstants;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author nanyang
 */
public class TFlupInfoDto {

    @Data
    @ApiModel("TFlupInfoDto - Insert")
    public static class Insert {

        @ApiModelProperty("档案号")
        private String fileNum;
        private String idcard;
        @ApiModelProperty("姓名")
        private String name;
        @ApiModelProperty("性别")
        private Byte sex;
        @ApiModelProperty("年龄")
        private Integer age;
        @ApiModelProperty("住院时间")
        private Date enterTime;
        @ApiModelProperty("出院时间")
        private Date leaveTime;
        @ApiModelProperty("危险分级")
        private Byte riskLevel;
        @ApiModelProperty("治疗类型(多选，值用逗号隔开)")
        private String treatmentType;
        @ApiModelProperty("随访轮次")
        private Byte round;
        @ApiModelProperty("随访时间")
        private Date flupTime;
        @ApiModelProperty("随访方式")
        private Byte flupMode;
        @ApiModelProperty("婚姻状况")
        private Byte maritalStatus;
        @ApiModelProperty("医疗付费方式")
        private Byte payMode;
        @ApiModelProperty("受教育程度")
        private Byte educationLevel;
        @ApiModelProperty("联系人姓名")
        private String contactName;
        @ApiModelProperty("电话1")
        private String firstPhone;
        @ApiModelProperty("电话2")
        private String secondPhone;
        @ApiModelProperty("电话3")
        private String thirdPhone;
        @ApiModelProperty("出院科别")
        private String leaveDepartment;
        @ApiModelProperty("居住详细地址")
        private String address;
        @ApiModelProperty("是否失访")
        private Byte lostFlupFlag;
        @ApiModelProperty("失访原因")
        private Byte lostFlupReason;
        @ApiModelProperty("是否死亡")
        private Byte deathFlag;
        @ApiModelProperty("死亡时间")
        private Date deathTime;
        @ApiModelProperty("死亡原因")
        private Byte deathReason;
        @ApiModelProperty("随访状态（0：待随访，1：已随访）")
        private Byte flupFlag;
        @ApiModelProperty("审核状态")
        private Byte auditStatus;
        @ApiModelProperty("数据来源")
        private Byte source;
        private String ssbm;
        public String getZllx() {
            if (StrUtil.isNotEmpty(ssbm)) {
                String[] split = ssbm.split(",");
                String str = "";
                for (String s : split) {
                    if (UserConstants.AISJMRS.contains(s)) {
                        str = "AIS静脉溶栓;";
                    }
                    if (UserConstants.AISJRZT.contains(s)) {
                        str += "AIS介入再通;";
                    }
                    if (UserConstants.NCX.contains(s)) {
                        str += "脑出血;";
                    }
                    if (UserConstants.LNDML.contains(s)) {
                        str += "颅内动脉瘤;";
                    }
                    if (UserConstants.CEA.contains(s) || UserConstants.CAS.contains(s)) {
                        str += "CEA/CAS;";
                    }
                }
                return Stream.of(str.split(";")).collect(Collectors.joining(","));
            }

            return null;
        }
    }

    @Data
    @ApiModel("TFlupInfoDto - 修改随访信息")
    public static class Update {
        @ApiModelProperty("ID")
        private Long id;
        @ApiModelProperty("档案号")
        private String fileNum;
        @ApiModelProperty("姓名")
        private String name;
        @ApiModelProperty("性别")
        private Byte sex;
        @ApiModelProperty("年龄")
        private Integer age;
        @ApiModelProperty("住院时间")
        private Date enterTime;
        @ApiModelProperty("出院时间")
        private Date leaveTime;
        @ApiModelProperty("危险分级")
        private Byte riskLevel;
        @ApiModelProperty("治疗类型(多选，值用逗号隔开)")
        private String treatmentType;
        @ApiModelProperty("随访轮次")
        private Byte round;
        @ApiModelProperty("随访时间")
        private Date flupTime;
        @ApiModelProperty("随访方式")
        private Byte flupMode;
        @ApiModelProperty("婚姻状况")
        private Byte maritalStatus;
        @ApiModelProperty("医疗付费方式")
        private Byte payMode;
        @ApiModelProperty("受教育程度")
        private Byte educationLevel;
        @ApiModelProperty("联系人姓名")
        private String contactName;
        @ApiModelProperty("电话1")
        private String firstPhone;
        @ApiModelProperty("电话2")
        private String secondPhone;
        @ApiModelProperty("电话3")
        private String thirdPhone;
        @ApiModelProperty("出院科别")
        private String leaveDepartment;
        @ApiModelProperty("居住详细地址")
        private String address;
        @ApiModelProperty("是否失访")
        private Byte lostFlupFlag;
        @ApiModelProperty("失访原因")
        private Byte lostFlupReason;
        @ApiModelProperty("是否死亡")
        private Byte deathFlag;
        @ApiModelProperty("死亡时间")
        private Date deathTime;
        @ApiModelProperty("死亡原因")
        private Byte deathReason;
        @ApiModelProperty("随访状态（0：待随访，1：已随访）")
        private Byte flupFlag;
        @ApiModelProperty("审核状态")
        private Byte auditStatus;
        @ApiModelProperty("数据来源")
        private Byte source;
    }

    @Data
    @ApiModel("TFlupInfoDto - 删除随访信息")
    public static class Delete {
        @ApiModelProperty("删除ID")
        private List<Long> idList;
    }


    @Data
    @ApiModel("TFlupInfoDto - 查询随访信息")
    public static class Query {
        @ApiModelProperty("姓名")
        private String name;
        private String idCard;
        private String fileNum;
        private String departmentId;
        @ApiModelProperty("危险分级")
        private Byte riskLevel;
        @ApiModelProperty("治疗类型")
        private String treatmentType;
        @ApiModelProperty("随访轮次")
        private Byte round;
        @ApiModelProperty("住院时间")
        private Date enterTimeStart;
        @ApiModelProperty("住院时间")
        private Date enterTimeEnd;
        @ApiModelProperty("出院时间")
        private Date leaveTimeStart;
        @ApiModelProperty("出院时间")
        private Date leaveTimeEnd;
        @ApiModelProperty("审核状态")
        private Byte auditStatus;
        @ApiModelProperty("是否死亡")
        private Byte deathFlag;
        @ApiModelProperty("是否失访")
        private Byte lostFlupFlag;
        @ApiModelProperty("数据来源")
        private Byte source;
    }

    @Data
    @ApiModel("TFlupInfoDto - 查询随访信息")
    public static class Export {
        @Excel(name = "姓名")
        @ApiModelProperty("姓名")
        private String name;
        @Excel(name = "危险分级")
        @ApiModelProperty("危险分级")
        private Byte riskLevel;
        @Excel(name = "治疗类型")
        @ApiModelProperty("治疗类型")
        private String treatmentType;
        @Excel(name = "随访轮次")
        @ApiModelProperty("随访轮次")
        private Byte round;
        @Excel(name = "住院时间")
        @ApiModelProperty("住院时间")
        private Date enterTimeStart;
        @Excel(name = "住院时间")
        @ApiModelProperty("住院时间")
        private Date enterTimeEnd;
        @Excel(name = "出院时间")
        @ApiModelProperty("出院时间")
        private Date leaveTimeStart;
        @Excel(name = "出院时间")
        @ApiModelProperty("出院时间")
        private Date leaveTimeEnd;
        @Excel(name = "审核状态")
        @ApiModelProperty("审核状态")
        private Byte auditStatus;
        @Excel(name = "是否死亡")
        @ApiModelProperty("是否死亡")
        private Byte deathFlag;
        @Excel(name = "是否失访")
        @ApiModelProperty("是否失访")
        private Byte lostFlupFlag;
        @Excel(name = "数据来源")
        @ApiModelProperty("数据来源")
        private Byte source;
    }

    @Data
    @ApiModel("TFlupInfoDto - 随访信息子表")
    public static class FirstAidRecordDto {
        @ApiModelProperty("key")
        private String code;
        @ApiModelProperty("value")
        private String answer;
    }

}
